﻿//======================================================================
//
//        Copyright (C) 2015   
//        All rights reserved
//
//        filename : PutInBadCard
//        description : 制卡坏卡入库

//        created by XXX at  20150821
//
//======================================================================
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using CardLogistics.Web.Components;
using System.Data;

namespace CardLogistics.Web.MainPage.PutInCard.PutInBadCard
{
    public partial class Detail : BasePage
    {
        private static readonly CardLogistics.DAL.PutInCard.PutInBadCardData DAL =new DAL.PutInCard.PutInBadCardData ();
        private static readonly CardLogistics.DAL.PutInCard.PutInBadCard_DetailData DDAL = new DAL.PutInCard.PutInBadCard_DetailData ();
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                InitControl();
            }
        }
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public void InitControl()
        {
            string _key = Request.QueryString["id"];
            if (!string.IsNullOrEmpty(_key))
            {
                CardLogistics.Model.PutInCard.PutInBadCard pData = DAL.GetModel(_key);
                SetWebControls(this.Page, pData);
                if (pData!= null)
                {
                    //坏卡入库日期
                    if (pData.BADCARDDATE != null)
                    {
                        BADCARDDATE.Text = DateTime.Parse(pData.BADCARDDATE.ToString()).ToString("yyyy-MM-dd");
                    }
                }
                DataTable dt = DDAL.GetInfoByBadCardId(pData.ID);//查询制卡坏卡入库明细信息
                if (dt.Rows.Count > 0)
                {
                    OutStorageNo.Text = dt.Rows[0]["OutStorageNo"].ToString();
                    rptDetailList.DataSource = dt;
                    rptDetailList.DataBind();
                }

            }
        }
    }
}